package com.yuanren.em.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.extension.activerecord.Model;

import java.math.BigDecimal;
import java.util.Date;

@TableName("t_user_member")
public class UserMember extends Model<UserMember> {
    
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    
    private Long userId;
    
    private Long currentLevelId;
    
    private Integer totalPoints;
    
    private Integer availablePoints;
    
    private BigDecimal totalSpent;
    
    private Date joinTime;
    
    private Date lastUpgradeTime;
    
    private Long nextLevelId;
    
    private Integer pointsToNextLevel;
    
    private Date updateTime;
    
    // 关联字段，不在数据库中存储
    @TableField(exist = false)
    private String userName;
    
    @TableField(exist = false)
    private String userNickname;
    
    @TableField(exist = false)
    private String userAvatar;
    
    @TableField(exist = false)
    private MemberLevel currentLevel;
    
    @TableField(exist = false)
    private MemberLevel nextLevel;

    public UserMember() {}

    public UserMember(Long userId, Long currentLevelId, Integer totalPoints, Integer availablePoints, BigDecimal totalSpent) {
        this.userId = userId;
        this.currentLevelId = currentLevelId;
        this.totalPoints = totalPoints;
        this.availablePoints = availablePoints;
        this.totalSpent = totalSpent;
        this.joinTime = new Date();
    }

    // Getters and Setters
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public Long getCurrentLevelId() {
        return currentLevelId;
    }

    public void setCurrentLevelId(Long currentLevelId) {
        this.currentLevelId = currentLevelId;
    }

    public Integer getTotalPoints() {
        return totalPoints;
    }

    public void setTotalPoints(Integer totalPoints) {
        this.totalPoints = totalPoints;
    }

    public Integer getAvailablePoints() {
        return availablePoints;
    }

    public void setAvailablePoints(Integer availablePoints) {
        this.availablePoints = availablePoints;
    }

    public BigDecimal getTotalSpent() {
        return totalSpent;
    }

    public void setTotalSpent(BigDecimal totalSpent) {
        this.totalSpent = totalSpent;
    }

    public Date getJoinTime() {
        return joinTime;
    }

    public void setJoinTime(Date joinTime) {
        this.joinTime = joinTime;
    }

    public Date getLastUpgradeTime() {
        return lastUpgradeTime;
    }

    public void setLastUpgradeTime(Date lastUpgradeTime) {
        this.lastUpgradeTime = lastUpgradeTime;
    }

    public Long getNextLevelId() {
        return nextLevelId;
    }

    public void setNextLevelId(Long nextLevelId) {
        this.nextLevelId = nextLevelId;
    }

    public Integer getPointsToNextLevel() {
        return pointsToNextLevel;
    }

    public void setPointsToNextLevel(Integer pointsToNextLevel) {
        this.pointsToNextLevel = pointsToNextLevel;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getUserNickname() {
        return userNickname;
    }

    public void setUserNickname(String userNickname) {
        this.userNickname = userNickname;
    }

    public String getUserAvatar() {
        return userAvatar;
    }

    public void setUserAvatar(String userAvatar) {
        this.userAvatar = userAvatar;
    }

    public MemberLevel getCurrentLevel() {
        return currentLevel;
    }

    public void setCurrentLevel(MemberLevel currentLevel) {
        this.currentLevel = currentLevel;
    }

    public MemberLevel getNextLevel() {
        return nextLevel;
    }

    public void setNextLevel(MemberLevel nextLevel) {
        this.nextLevel = nextLevel;
    }

    @Override
    public String toString() {
        return "UserMember{" +
                "id=" + id +
                ", userId=" + userId +
                ", currentLevelId=" + currentLevelId +
                ", totalPoints=" + totalPoints +
                ", availablePoints=" + availablePoints +
                ", totalSpent=" + totalSpent +
                ", joinTime=" + joinTime +
                ", lastUpgradeTime=" + lastUpgradeTime +
                ", nextLevelId=" + nextLevelId +
                ", pointsToNextLevel=" + pointsToNextLevel +
                ", updateTime=" + updateTime +
                '}';
    }
} 